#include "listeusers.h"

ListeUsers::ListeUsers()
{

}
QStringList ListeUsers::toStringList()
{
    QStringList result;
    User u;
    foreach(u, *this)
    {
        result << QString::number(u.getId()) + " - " + u.getNom() + ", " + u.getContact().NomEtPrenom();
    }
    return result;
}
User ListeUsers::getById(int id)
{
    User u;
    foreach(u, *this)
    {
        if (u.getId() == id)
            return u;
    }
    return u;
}
void ListeUsers::setListeUsers(QSqlQuery query)
{
    while(query.next())
    {
        User user(query);
        this->append(user);
    }
}
